function rv=load_balance(filename);
rv=0;
%read data
fid=fopen(filename,'r');

while(1)
    %read txt
    while(1)
        if feof(fid)
            return;
        end
        line=fgetl(fid);
        if length(line)>1 && line(1)~='#'
            break;
        end
    end
    data_temp=sscanf(line,'%d %d');
    
    M=data_temp(1);%job
    N=data_temp(2);%computer
    job_com=zeros(M,2);%specified computer
    for idx=1:M
         line=fgetl(fid);
         if length(line)>1 && line(1)~='#'
            data_temp=sscanf(line,'%d %d'); 
            job_com(idx,1)=data_temp(1);
            job_com(idx,2)=data_temp(2);
         end
    end
    %construct a graph
    V_num=1+M+N+1;
    Capacity=zeros(V_num,V_num);%0:no edge

    Capacity(V_num-M:V_num-1,V_num)=1;
    for idx=1:M
        Capacity(1+job_com(idx,1),1+N+idx)=1;
        Capacity(1+job_com(idx,2),1+N+idx)=1;
    end
    %init
    L=1;
    data_floor=1;
    data_ceiling=M;
    while(1)
        Capacity(1,2:N+1)=L;
        [C_f f]=Ford_Fullerson(Capacity);
        
        %devide
        if sum(f(1,:),2)-sum(f(:,1),1)>=M
            data_ceiling=L;
            L=floor((L+data_floor)/2);
        else
            data_floor=L;
            L=floor((L+data_ceiling)/2);
        end
        %exist
         if data_ceiling-data_floor<1.5
             %disp(f);
             disp('min max load:');
             disp(data_ceiling);
             break;
         end
    end
end
end